From 97872f59f1b8af9eb1d71f12071747d6fa143823 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sat, 21 Apr 2007 14:27:59 +0000 Subject: [PATCH] Fix #9630 : Limits links in Whatlinkshere forget about namespace filter * marks '$namespace' private too --- RELEASE-NOTES | 1 + includes/SpecialWhatlinkshere.php | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f16e852ae4..21d95d8136 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -339,6 +339,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Fixed odd behaviour in ImagePage on DjVu thumbnailing errors * (bug 5439) "Go" title search will now jump to shared/foreign Image: and MediaWiki: pages that have not been locally edited. +* (bug 9630) Limits links in Whatlinkshere forgot about namespace filter == Maintenance == diff --git a/includes/SpecialWhatlinkshere.php b/includes/SpecialWhatlinkshere.php index dff036a1d0..277e279fdb 100644 --- a/includes/SpecialWhatlinkshere.php +++ b/includes/SpecialWhatlinkshere.php @@ -20,9 +20,11 @@ function wfSpecialWhatlinkshere($par = NULL) { */ class WhatLinksHerePage { var $request, $par; - var $limit, $from, $back, $target, $namespace; + var $limit, $from, $back, $target; var $selfTitle, $skin; + private $namespace; + function WhatLinksHerePage( &$request, $par = null ) { global $wgUser; $this->request =& $request; @@ -242,19 +244,24 @@ class WhatLinksHerePage { return $this->skin->makeKnownLinkObj( $this->selfTitle, $text, $query ); } - function getPrevNext( $limit, $prevId, $nextId, $namespace ) { + function getPrevNext( $limit, $prevId, $nextId ) { global $wgLang; $fmtLimit = $wgLang->formatNum( $limit ); $prev = wfMsgExt( 'whatlinkshere-prev', array( 'parsemag', 'escape' ), $fmtLimit ); $next = wfMsgExt( 'whatlinkshere-next', array( 'parsemag', 'escape' ), $fmtLimit ); + $nsText = ''; + if( is_int($this->namespace) ) { + $nsText = "&namespace={$this->namespace}"; + } + if ( 0 != $prevId ) { - $prevLink = $this->makeSelfLink( $prev, "limit={$limit}&from={$this->back}&namespace={$namespace}" ); + $prevLink = $this->makeSelfLink( $prev, "limit={$limit}&from={$this->back}{$nsText}" ); } else { $prevLink = $prev; } if ( 0 != $nextId ) { - $nextLink = $this->makeSelfLink( $next, "limit={$limit}&from={$nextId}&back={$prevId}&namespace={$namespace}" ); + $nextLink = $this->makeSelfLink( $next, "limit={$limit}&from={$nextId}&back={$prevId}{$nsText}" ); } else { $nextLink = $next; } @@ -267,9 +274,10 @@ class WhatLinksHerePage { return wfMsg( 'viewprevnext', $prevLink, $nextLink, $nums ); } - function numLink( $limit, $from ) { + function numLink( $limit, $from, $ns = null ) { global $wgLang; $query = "limit={$limit}&from={$from}"; + if( is_int($this->namespace) ) { $query .= "&namespace={$this->namespace}";} $fmtLimit = $wgLang->formatNum( $limit ); return $this->makeSelfLink( $fmtLimit, $query ); } @@ -297,7 +305,8 @@ class WhatLinksHerePage { return $f; } - function setNamespace( $ns ) { + /** Set the namespace we are filtering on */ + private function setNamespace( $ns ) { $this->namespace = $ns; } -- 2.20.1